home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1994 / MacHack 1994.toast / MacHack™ 1987-1994 / MacHack™ '90 / MacHack 90 Contest Entries / This™ patch / This.a < prev    next >
Encoding:
Text File  |  1990-06-14  |  2.8 KB  |  156 lines  |  [TEXT/MPS ]

  1. * This™ by Dean Yu
  2. * Really personalise your System 7 Macintosh.
  3.  
  4.             INCLUDE 'ToolEqu.a'
  5.             INCLUDE 'SysEqu.a'
  6.             INCLUDE 'Traps.a'
  7.             
  8. This        PROC    EXPORT
  9.             IMPORT    DrawStrPtch
  10.             IMPORT    ShowPatch
  11.             
  12.             move.l    a0,-(sp)
  13.             _DetachResource
  14.             
  15.             move.w    #$13d,d0            ; Trap number for _MenuSelect
  16.             _GetTrapAddress ,NEWTOOL
  17.             lea        DrawStrPtch,a1
  18.             move.l    a0,2(a1)            ; Save old _MenuSelect routine
  19.             move.l    a1,a0
  20.             move.w    #$13d,d0
  21.             _SetTrapAddress ,NEWTOOL
  22.             
  23.             move.w    #$115,d0            ; Trap number for _ShowWindow
  24.             _GetTrapAddress ,NEWTOOL
  25.             lea        ShowPatch,a1
  26.             move.l    a0,2(a1)            ; Save old _ShowWindow routine
  27.             move.l    a1,a0
  28.             move.w    #$115,d0
  29.             _SetTrapAddress ,NEWTOOL
  30.             
  31.             rts
  32.             ENDPROC
  33.  
  34. DrawStrPtch    PROC    EXPORT
  35.             IMPORT    makeString
  36.             bra.s    startPatch
  37. oldDrawStr    ds.l    1
  38.  
  39. startPatch    lea        FinderName,a0        ; Make sure we’re only active in the Finder
  40.             lea        CurApName,a1
  41.             
  42.             cmp.l    (a0)+,(a1)+
  43.             bne.s    toOldDraw
  44.             cmp.w    (a0)+,(a1)+
  45.             bne.s    toOldDraw
  46.  
  47.             pea        nameHolder
  48.             jsr        makeString
  49.             
  50. stashReplac    move.l    menuList,a0
  51.             move.l    (a0),a0
  52.             move.l    6(a0),-(sp)
  53.             move.w    #1,-(sp)
  54.             pea        replaceStr
  55.             _SetItem
  56.             
  57. toOldDraw    move.l    oldDrawStr,a0
  58.             jmp        (a0)
  59.  
  60.             STRING    ASIS
  61. aboutString    dc.b    'About this Macintosh®'
  62. replaceStr    dc.b    60
  63.             dc.b    'About '
  64. nameHolder    dc.l    0
  65.             dc.l    0
  66.             dc.l    0
  67.             dc.l    0
  68.             dc.l    0
  69.             dc.l    0
  70.             dc.l    0
  71.             dc.l    0
  72.             dc.l    0
  73.             dc.l    0
  74. macString    dc.b    '’s Macintosh®…'
  75.             ENDPROC
  76.  
  77. ShowPatch    PROC    EXPORT
  78.             IMPORT    makeString
  79.             bra.s    startPatch
  80. oldShow        ds.l    1
  81.  
  82. startPatch    lea        FinderName,a0        ; Make sure we’re only active in the Finder
  83.             lea        CurApName,a1
  84.             
  85.             cmpi.b    #$ff,(a0)            ; Special case for startup time
  86.             beq.s    toOldShow
  87.             
  88.             cmp.l    (a0)+,(a1)+
  89.             bne.s    toOldShow
  90.             cmp.w    (a0)+,(a1)+
  91.             bne.s    toOldShow
  92.  
  93.             move.l    4(sp),-(sp)
  94.             pea        windName
  95.             _GetWTitle
  96.  
  97.             lea        windName,a0
  98.             lea        aboutString,a1
  99.             move.l    #12,d0
  100. cmpLoop        cmp.b    (a0)+,(a1)+
  101.             bne.s    toOldShow
  102.             dbra    d0,cmpLoop
  103.             
  104.             pea        nameHolder
  105.             jsr        makeString
  106.             
  107. stashReplac    move.l    4(sp),-(sp)
  108.             pea        replaceStr
  109.             _setWTitle
  110.             
  111. toOldShow    move.l    oldShow,a0
  112.             jmp        (a0)
  113.             STRING    PASCAL
  114. aboutString    dc.b    'About this Macintosh®'
  115.             STRING    ASIS
  116. replaceStr    dc.b    60
  117.             dc.b    'About '
  118. nameHolder    dc.l    0
  119.             dc.l    0
  120.             dc.l    0
  121.             dc.l    0
  122.             dc.l    0
  123.             dc.l    0
  124.             dc.l    0
  125.             dc.l    0
  126.             dc.l    0
  127.             dc.l    0
  128. macString    dc.b    '’s Macintosh®'
  129. windName    ds.b    256
  130.             ENDPROC
  131.                         
  132. makeString    PROC    EXPORT
  133.             move.l    #9,d0
  134.             move.l    4(sp),a0
  135. clearName    clr.l    (a0)+
  136.             dbra    d0,clearName
  137.  
  138.             sub.w    #4,sp
  139.             move.l    #'STR ',-(sp)
  140.             move.w    #-16096,-(sp)
  141.             _GetResource
  142.             move.l    (sp),a0                ; Get the Chooser name
  143.  
  144.             move.l    (a0),a0
  145.             moveq.l    #0,d0
  146.             move.b    (a0),d0
  147.             add.w    #1,a0
  148.             move.l    8(sp),a1
  149.             _BlockMove                    ; Copy the name into replacement string
  150.             
  151.             _ReleaseResource
  152.             move.l    (sp)+,a0
  153.             add.w    #4,sp
  154.             jmp        (a0)
  155.             ENDPROC
  156.             END